﻿using System.Collections.Generic;

namespace BtcsCon
{
    /***************Base Class & Common Class**********************************/
    public class BTCSInfo
    {
        public string commandType;
        public string commandCode;
        public string deviceSn;

        public BTCSInfo() { }
        public BTCSInfo(string commandType, string commandCode, string deviceSn)
        {
            this.commandType = commandType;
            this.commandCode = commandCode;
            this.deviceSn = deviceSn;
        }
    }

    public class KVPair
    {
        public string attrName;
        public string attrValue;
        public KVPair(string attrName, string attrValue)
        {
            this.attrName = attrName;
            this.attrValue = attrValue;
        }
    }

    public class DeviceInfo
    {
        public string currentVelocity;
        public string maxVelocity;
        public string maxReverseVelocity;
        public string loadRange;
        public string driveType;
        public string navigationType;
        public string nodeSn;
        public string xPosition;
        public string yPosition;
        public string mode;
        public string headStockAngle;

        public DeviceInfo() { }
        public DeviceInfo(string currentVelocity, string maxVelocity,
            string maxReverseVelocity, string loadRange, string driveType,
            string navigationType, string nodeSn, string xPosition,
            string yPosition, string mode, string headStockAngle)
        {
            this.currentVelocity = currentVelocity;
            this.maxVelocity = maxVelocity;
            this.maxReverseVelocity = maxReverseVelocity;
            this.loadRange = loadRange;
            this.driveType = driveType;
            this.navigationType = navigationType;
            this.nodeSn = nodeSn;
            this.xPosition = xPosition;
            this.yPosition = yPosition;
            this.mode = mode;
            this.headStockAngle = headStockAngle;
        }
    }

    /****************下发任务**************************************/
    public class PointDto
    {
        public string pointSn;
        public string angle;
        public string ip;
        public string xPosition;
        public string yPosition;
        public List<KVPair> attrDto = new List<KVPair>();
    }

    public class RoadInfo
    {
        public string roadType;
        public string moveType;
        public string controlPoints;
        public string roadWidth;
        public string maxVelocity;
        public PointDto startPointDto = new PointDto();
        public PointDto endPointDto = new PointDto();
    }

    public class TaskCommandContent
    {
        public string taskType;
        public string taskNo;
        public string startSn;
        public string endSn;
        public List<RoadInfo> pathDtos = new List<RoadInfo>();
    }

    public class BTCSTask : BTCSInfo
    {
        public const string TYPECODE = "1";
        public TaskCommandContent commandcontent = new TaskCommandContent();
    }

    /********************上传心跳信息*******************************************/
    public class HeartCommandContent
    {
        public string deviceSn;
        public string deviceTypeSn;
        public string ip;
        public string token;
        public string status;
        public string activeStatus;
        public string deviceStyle;
        public string productId;
        public string currentStatus;
        public DeviceAttrInfo deviceAttrInfo = new DeviceAttrInfo();
    }

    public class BTCSAck : BTCSInfo
    {  //AGV Heartbeat
        public const string TYPECODE = "4";
        public HeartCommandContent commandcontent = new HeartCommandContent();
    }

    public class DeviceAttrInfo : DeviceInfo
    { // Device Heartbeat
        public string nextNodeSn;
        public string power;
        public string taskStatus;
    }

    /******************下发设备信息*********************************************/
    public class DeviceCommandContent
    {
        public string deviceSn;
        public string deviceTypeSn;
        public string ip;
        public string token;
        public string status;
        public string activeStatus;
        public string deviceStyle;
        public string productId;
        public string currentStatus;
        public DeviceInfo deviceAttrInfo = new DeviceInfo();
    }
    public class BTCSDevice : BTCSInfo
    {
        public const string TYPECODE = "2";
        public DeviceCommandContent commandcontent = new DeviceCommandContent();
    }

    /****************下发动作类************************************************/
    public class BTCSAction : BTCSInfo
    {
        public const string TYPECODE = "3";
        public List<KVPair> commandcontent = new List<KVPair>();
    }

    /****************上传请求指令类************************************************/
    public class BTCSRequest : BTCSInfo
    {
        public const string TYPECODE = "6";
        public List<KVPair> commandcontent = new List<KVPair>();
        public BTCSRequest(string commandType, string commandCode, string deviceSn) :
            base(commandType, commandCode, deviceSn)
        {
        }
    }

}
